package com.serie402.web.action;

import org.apache.log4j.Logger;

import com.kiss.fw.action.AbstractAction;
import com.kiss.fw.context.ActionContext;
import com.kiss.fw.exceptions.ActionException;
import com.serie402.common.delegate.MultimediaDelegate.GalleryDelegate;
import com.serie402.common.dto.GalleryDTO;
import com.serie402.common.dto.page.GalleryPageDTO;
import com.serie402.common.utils.Constants;

/*
 * @author Edwin.Fernandez
 */
public final class GalleryAction extends AbstractAction {
	private static Logger logger = Logger.getLogger(GalleryAction.class);
	
	@Override
	public boolean validate(final ActionContext _context) {
		return true;
	}
	
	@Override
	public void execute(ActionContext _context) throws ActionException {
		GalleryPageDTO pageDto = new GalleryPageDTO();
		GalleryDTO dto = new GalleryDTO();
		
		try {
			if(_context.isReadAction()) {
				GalleryDelegate.read(dto);
			}
		}
		catch(Exception _exception) {
			handleActionException(logger, "execute", _exception);
		}
		
		pageDto.setPhotoAlbums(dto.getPhotoAlbums());
		pageDto.setPageTitle("Gallery");
		pageDto.setWindowTitle("Gallery");
		
		_context.setRequestAttribute(Constants.Mappings.GALLERY_DTO, pageDto);
	}
	
	@Override
	public void create(ActionContext _context) throws ActionException {
	}
	
	@Override
	public void read(ActionContext _context) throws ActionException {
	}
	
	@Override
	public void update(ActionContext _context) throws ActionException {
	}
	
	@Override
	public void delete(ActionContext _context) throws ActionException {
	}
	
	@Override
	public void search(ActionContext _context) throws ActionException {
	}
	
	@Override
	public void browse(ActionContext _context) throws ActionException {
	}
}